package com.atguigu.strategy.improve;

/**
 * @program: design-patterns
 * @author: yangshen
 * @description:
 * @create: 2022-04-04 18:26
 **/
public class Client {
    public static void main(String[] args) {
        WildDuck wildDuck = new WildDuck();
        wildDuck.fly();
        wildDuck.quack();

        ToyDuck toyDuck = new ToyDuck();
        toyDuck.fly();
        toyDuck.quack();

        PekingDuck pekingDuck = new PekingDuck();
        pekingDuck.fly();
        pekingDuck.quack();


        //动态改变某个对象的行为， 北京鸭 不能飞
        //或者在Duck类中都 flyBehavior 属性接口添加set方法来更改新对象
        pekingDuck.flyBehavior = new NoFlyBehavior();
        pekingDuck.fly();

    }
}
